package edu.bupt.changelog.history;

public class HistoryUtils {

    /**判断一个对象是否是基本类型或基本类型的封装类型*/
    public static boolean isPrimitive(Object obj) {
        try {
            return ((Class<?>)obj.getClass().getField("TYPE").get(null)).isPrimitive();
        } catch (Exception e) {
            return false;
        }
    }

    public static boolean isPrimitiveOrString(Object obj){
        return isPrimitive(obj) || obj instanceof String;

    }

    //是基本类型class或String.class;
    public static boolean isBasicClass(Class a){
        return a.equals(int.class)
                || a.equals(long.class)
                || a.equals(Integer.class)
                || a.equals(Long.class)
                || a.equals(String.class);
    }
}
